package com.czxy.service;

import com.czxy.dao.SkuRepository;
import com.czxy.pojo.group.BaseResult;
import com.czxy.vo.SkuSearchRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 查询功能--Service
 * @author Liuyunqin 17674029449@163.com
 * @date 2018/12/26 10:18
 */
@Service
@Transactional
public class SkuSearchService {
    @Autowired
    private SkuRepository skuRepository;

    /**
     * 查询功能
     * @return
     */
    public Object search(SkuSearchRequest req){
        //1. 如果三级分类是空
        if (req.getCatid()==null) {
            BaseResult br = new BaseResult(1,"没有数据");
            return ResponseEntity.ok(br);
        }
        //2. 创建查询构建器
        NativeSearchQueryBuilder queryBuilder = new NativeSearchQueryBuilder();
        //3. 三级类目
        return null;

    }
}
